package com.skyk.util.context;

import com.skyk.pojo.entity.User;

// 创建ThreadLocal来存储用户信息

public class UserContext {
    private static final ThreadLocal<User> userInfoThreadLocal = new ThreadLocal<>();

    public static void setUser( User user){
        userInfoThreadLocal.set(user);
    }

    public static User getUser(){
        return userInfoThreadLocal.get();
    }

    public static void clear(){
        userInfoThreadLocal.remove();
    }

}
